{include file='admin/before_body.phtml' title='后台首页'}
<style type="text/css">
#msg .alert { padding: 5px; }
</style>
<body class="login-layout">
  <div class="main-container">
    <div class="main-content">
      <div class="col-sm-10 col-sm-offset-1">
        <div class="login-container">
          <div class="center"><h1><span class="white">阿道夫双11小程序</span></h1></div>
          <div class="space-6"></div>
          <div class="position-relative">
            <div id="login-box" class="login-box visible widget-box no-border">
              <div class="widget-body">
                <div class="widget-main">
                <h4 class="header blue lighter bigger"><i class="icon-user green"></i> 管理登陆</h4>
                <div id="msg">{html_messages}</div>
                <div class="space-6"></div>
                  <form method="POST" id="form">
                    <fieldset>
                      <label class="block clearfix">
                        <span class="block input-icon input-icon-right">
                          <input type="text" name="username" id="username" class="form-control" placeholder="用户名" />
                          <i class="icon-user"></i>
                        </span>
                      </label>
                      <label class="block clearfix">
                        <span class="block input-icon input-icon-right">
                          <input type="password" name="password" id="password" class="form-control" placeholder="密码" />
                          <i class="icon-lock"></i>
                        </span>
                      </label>
                      <label class="block clearfix">
                        <span class="input-group">
                          <input class="form-control" placeholder="验证码" name="code" id="code"/>
                          <a class="input-group-addon code" style="cursor: pointer;border-left: 0;padding: 0;"><img id="show-code" style="height: 30px;" src="{url('code/admin/user/login?')}{time()}"></a>
                          <a class="input-group-addon code" style="cursor: pointer;"><i class="icon-refresh"></i></a>
                        </span>
                      </label>
                      <div class="space"></div>
                      <div class="clearfix">
                        <button type="button" class="width-35 pull-right btn btn-sm btn-primary" id="loginBtn">
                          登录</button>
                      </div>
                      <div class="space-4"></div>
                    </fieldset>
                  </form>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</body>
{include file='admin/after_body.phtml'}
<script>
$(function() {
  $('.code').click(function() {
   console.log(111, '{url("code/admin/login?")}' + (new Date() - 0));
    $('#show-code').attr('src', '{url("code/admin/user/login?")}' + (new Date() - 0));
  });
  var funSetMsg = (msg, type) => $('#msg').html('<div class="alert alert-block alert-' + (type||'info') + '"><button type="button" class="close" data-dismiss="alert"><i class="icon-remove"></i></button>' + msg + '</div>');
  $('#loginBtn').click(function() {
    var username =  $.trim($('#username').val()),
      password = $('#password').val(), code = $('#code').val();
    if (!username) { return funSetMsg('请输入用户名', 'danger')}
    if (!password) { return funSetMsg('请输入用户密码', 'danger')}
    if (!code) { return funSetMsg('请输入验证码', 'danger')}
    $('#form').submit();
  });
})
</script>
</html>

